<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link th:href="@{/css/style.css}" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="sider">
        <div th:replace="menu::menu"></div>
    </div>
    <div class="main">
        <iframe name="main"></iframe>
    </div>
</div>

<script>
    window.onload = function () {
        let tar = document.getElementsByClassName("top-menu");
        for( let item of tar){
            console.log(item);
            item.onclick = function(){

                console.log(this.parentNode.childNodes);
                let ele = this.parentNode.childNodes[3];
                if(ele.style.display == 'none'){
                    ele.style.display = 'block';
                }else{
                    ele.style.display = 'none';
                }
                // this.parentNode.childNodes[3].style.display = "none";
            }
        }
    }
</script>
</body>
</html>